﻿using UnityEngine;

namespace Framework.UGUI
{
	public static class UIEventDebugger
	{
		public static void LogUIEventError(string eventName, GameObject go)
		{
#if UNITY_EDITOR
			if (GameState.isRunning)
			{
				Logger.LogError(string.Format("{0} 监听未移除 {1} ", eventName, GetGOPath(go)));
			}
#endif
		}

		private static object GetGOPath(GameObject go)
		{
			string ans = go.name;
			Transform parent = go.transform.parent;
			while (parent)
			{
				ans = string.Format("{0}/{1}", parent.name, ans);
				parent = parent.parent;
			}
			return ans;
		}
	}
}
